package fitness;

import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

import character.Shaman;

public class ShamanFitness extends FitnessFunction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9157068515429071083L;

	@Override
	protected double evaluate(IChromosome profile) {

		Integer strength = (Integer) profile.getGene(0).getAllele();
		Integer agility =  (Integer) profile.getGene(1).getAllele();
		Integer stamina =  (Integer) profile.getGene(2).getAllele();
		Integer intellect =  (Integer) profile.getGene(3).getAllele();
		Integer spirit =  (Integer) profile.getGene(4).getAllele();
		
		Shaman shaman = new Shaman();
		shaman.setStrength(strength);
		shaman.setAgility(agility);
		shaman.setStamina(stamina);
		shaman.setIntellect(intellect);
		shaman.setSpirit(spirit);
		
		double res = 10.917  * shaman.getAttackPower() +
					 10.917  * shaman.getArmor() + 
					 8.734  * shaman.getSpeed() +
					 10.917  * shaman.getResilience() + 
					 10.917  * shaman.getDodgeRating() + 
					 1.965  * shaman.getMana() +
					 1.965 * shaman.getHealth() +
					 10.917  * shaman.getSpellPenetration() +
					 10.917  * shaman.getHaste() + 
					 10.917  * shaman.getHealthRegeneration() +
					 10.917  * shaman.getManaRegeneration();
		return res;
	}

}
